using System;
using Whisper.CommonTypes;
using Whisper.Interfaces;

namespace Whisper.Objects
{
    public class RetrieveConversationClientController
    {
        private readonly IConversationServiceAdapter Adapter;
        private readonly IRetrieveConversationClientView View;

        public RetrieveConversationClientController(IConversationServiceAdapter adapter, IRetrieveConversationClientView view)
        {
            Adapter = adapter;
            View = view;
            View.RetrieveAvailableSubscriptions += RetrieveAvailableSubscriptions;
        }

        void RetrieveAvailableSubscriptions(object sender, EventArgs e)
        {
            IConversationList conversations = Adapter.GetAvailableConversations();
            View.AvailableConversations=conversations;
        }
    }
}